package me.jessyan.mvparms.demo.di.module.auth;

import com.jess.arms.di.scope.ActivityScope;
import com.tbruyelle.rxpermissions2.RxPermissions;

import dagger.Module;
import dagger.Provides;

import me.jessyan.mvparms.demo.mvp.contract.auth.AuthContract;
import me.jessyan.mvparms.demo.mvp.model.auth.AuthModel;


@Module
public class AuthModule {
    private AuthContract.View view;

    /**
     * 构建AuthModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public AuthModule(AuthContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    AuthContract.View provideAuthView() {
        return this.view;
    }

    @ActivityScope
    @Provides
    AuthContract.Model provideAuthModel(AuthModel model) {
        return model;
    }

    @ActivityScope
    @Provides
    RxPermissions providePersonalRxPermissions(){
        return new RxPermissions(view.getActivity());
    }

}